import request from '@/utils/request'
const api_name='/eduorder/order'

export default {
  //1、创建订单
  createOrder(courseId){
    return request({
      url: `${api_name}/createOrder/${courseId}`,
      method: 'post'
    })
  },
  //2、根据id获取订单
  getById(orderNo){
    return request({
      url: `${api_name}/getOrder/${orderNo}`,
      method: 'get'
    })
  },
  createNative(cid) {
    return request({
      url: '/eduorder/payLog/createNative/'+cid,
      method: 'get'
    })
  },
  queryPayStatus(cid) {
    return request({
      url: '/eduorder/payLog/queryPayStatus/'+cid,
      method: 'get'
    })
  },

  //获取用户所有订单
  getOrderList(){
    return request({
      url: `/eduorder/order/orderList`,
      method: 'get'
    })
  },

  //根据订单id删除订单
  removeOrderById(orderId){
    return request({
      url: `/eduorder/order/removeOrder/${orderId}`,
      method: 'delete'
    })
  },
  //查询订单表中订单的状态 判断课程是否购买
  isBought(courseId) {
    return request({
      url: `/eduorder/order/isBought/${courseId}`,
      method: 'get'
    })
  },
}
